package com.designCreator.view
{
	import com.designCreator.notifications.NotificationNames;
	
	import org.puremvc.as3.interfaces.IMediator;
	import org.puremvc.as3.interfaces.INotification;
	import org.puremvc.as3.patterns.mediator.Mediator;
	
	public class DesignCreatorMediator extends Mediator implements IMediator
	{
		public static const NAME : String = "DesignCreatorMediator";
		
		public function get designCreator() : DesignCreator1
		{
			return viewComponent as DesignCreator1;
		}
		
		public function DesignCreatorMediator( designCreator : DesignCreator1 )
		{
			super( NAME, designCreator );
		}
		
		override public function onRegister():void
		{
			facade.registerMediator( new ConfigurationTabsMediator(designCreator.mainView.configTabs));
		}
		
		override public function listNotificationInterests() : Array
		{
			return [
				NotificationNames.LOAD_FABRIC_TAB,NotificationNames.LOAD_STYLE_TAB
				];
		}
		
		override public function handleNotification( note : INotification ) : void
		{
			switch (note.getName())
			{
				case NotificationNames.LOAD_FABRIC_TAB:
					designCreator.mainView.onTabChange('FABRIC',true);
					break;
				
				case NotificationNames.LOAD_STYLE_TAB:
					designCreator.mainView.onTabChange('STYLE',true);
					break;
			}	
		}
	}
}